package com.small.nine.wxmp.domain.bean.wx.kf.msg;

import com.small.nine.wxmp.common.constant.WxConstant;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.HashMap;
import java.util.Map;

/**
 * 客服返回 音乐信息
 *
 * @author sheng_zs@126.com
 * @date 2021-08-06 17:03
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class WxKfMusicMsgBean extends WxKfMsgBaseBean {
    private static final long serialVersionUID = 1L;

    /**
     * 音乐内容
     */
    private Map<String, String> music;

    /**
     * 初始化，并返回
     *
     * @param toUser       发送对象
     * @param musicUrl     音乐 url
     * @param hqMusicUrl   高清音乐 url
     * @param thumbMediaId thumbMediaId
     * @param title        标题
     * @param description  说明
     * @return {@link WxKfMusicMsgBean}
     */
    public static WxKfMusicMsgBean getInstance(String toUser, String musicUrl, String hqMusicUrl,
                                               String thumbMediaId, String title, String description) {
        WxKfMusicMsgBean msgBean = new WxKfMusicMsgBean();
        msgBean.setToUser(toUser);
        msgBean.setMsgType(WxConstant.MSG_TYPE_MUSIC);
        // 音乐信息
        Map<String, String> map = new HashMap<>();
        map.put(WxConstant.PARAM_TITLE, title);
        map.put(WxConstant.PARAM_DESCRIPTION, description);
        map.put(WxConstant.PARAM_MUSIC_URL, musicUrl);
        map.put(WxConstant.PARAM_HQ_MUSIC_URL, hqMusicUrl);
        map.put(WxConstant.PARAM_THUMB_MEDIA_ID, thumbMediaId);
        msgBean.setMusic(map);
        return msgBean;
    }
}
